import axios from 'axios'
// axios.defaults.baseURL = 'http://liufusong.top:8080'
import store from '@/store'
export const request = axios.create({
  baseURL: 'http://liufusong.top:8080'
})
// 拦截请求
request.interceptors.request.use((config) => {
  if (store.state.user) { config.headers.Authorization = store.state.user.token }
  return config
})

// 拦截所有结果
request.interceptors.response.use(res => {
  return res.data.body
})
export default request
